import { Message } from 'element-ui'
export function beforeAvatarUpload(file) {
  const isJPG = file.type === 'image/jpeg' ? true : file.type === 'image/png' ;
  const isLt2M = file.size / 1024 / 1024 < 10;

  if (!isJPG) {
    Message({
      message: '上传图片只能是 JPG/PNG 格式!',
      type: 'error',
      duration: 5 * 1000
    })
  }
  if (!isLt2M) {
    Message({
      message: '上传图片大小不能超过 10MB!',
      type: 'error',
      duration: 5 * 1000
    })
  }
  return isJPG && isLt2M;
}
